#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
game()
{
	int ret = rand()%100;
	int guess = 0;
	while (1)
	{
		printf("请猜数字：\n");
		scanf("%d", &guess);
		if (guess == ret)
		{
			printf("恭喜你，猜对了\n");
			break;
		}
		else if (guess > ret)
		{
			printf("猜大了！\n");
		}
		else
		{
			printf("猜小了！\n");
		}
	}

}
void menu()
{
	printf("*********************************\n");
	printf("*****1->玩游戏***0->退出游戏*****\n");
	printf("*********************************\n");
}
int main()
{
	srand((unsigned int)time(NULL));
	int input = 0;
	

	do
	{
		menu();
		printf("请选择：\n");
		scanf("%d", &input);
		switch (input)
		{
		case 1:
			game();
			break;
		case 0:
			printf("游戏已退出\n");
			break;
		default:
			printf("输入错误\n");
			break;
		}

	} while (input);


	return 0;
}